<?php

/**
 * Description of ExtJSResultProvider
 *
 * @author prometheus
 */
class XDS_DataSource_ExtJS_ResultProvider extends XDS_DataSource_ResultProvider
{
	public $xName = 'ExtJS adatforrás lekérési eredmény szolgáltató';

	public function get()
	{
		$result = new XDS_DataSource_ExtJS_Result();
		
		if (isset($this->recordset))
		{
			foreach ($this->recordset as $record)
			{
				$result->data[] = $record->get();
			}
		}

		$result->totalCount = $this->recordset->count;
		$result->success = !is_null($this->recordset);
		
		return $result;
	}

	/**
	 * JSON kimenet!
	 */
	public function __toString()
	{
		return json_encode($this->get());
	}
}

?>